package com.atguigu.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.util.Date;

//默认去找与POJO类对应的表 (首字母小写)
@Data
@NoArgsConstructor
@AllArgsConstructor
//指定对应的表单
@Document("Actor")
public class Actor {

//    如果主键名称是id的话,那么就不用标记注解了
//    表示当前属性与mongodb的主键相对应
    @Id
    private String id;

//    @Field注解可以使此属性与表单列名绑定
    @Field("actorName")
    private String actorName;
    private boolean gender;
    private Date birth;

    @Override
    public String toString() {
        return "Actor{" +
                "id='" + id + '\'' +
                ", actorName='" + actorName + '\'' +
                ", gender=" + gender +
                ", birth=" + birth +
                '}';
    }
}
